home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1183_make_dependencies_and_header_files.rtf < prev    next >
Text File  |  1995-06-12  |  3KB  |  75 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f3\fswiss Helvetica;\f2\fmodern Ohlfs;}
  2. \paperw11760
  3. \paperh7200
  4. \margl120
  5. \margr120
  6. {\colortbl;\red0\green0\blue0;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q:  How can I get 
  8. \b make
  9. \b0  to recompile my program when I've only edited one of the .h files? I've changed the class by editing the interface file, but it thinks the program is up to date.  \
  10. \
  11. Q: Is there an easy way to recursively trace all the header files that my source file depends on?\
  12. \
  13. A:  You can, of course, fool 
  14. \b make
  15. \b0  by typing\
  16. \
  17.  
  18. \f1\fs24\fc1\cf1     touch foo.m\
  19.  
  20. \fs28\fc0\cf0 \
  21.  
  22. \f0 in a shell, before compiling, but that's not a very elegant solution.  What you need is a 
  23. \b Makefile.dependencies
  24. \b0  file.  \
  25. \
  26. In NEXTSTEP Release 2, this can be easily generated by typing\
  27. \
  28.  
  29. \f1\fs24\fc1\cf1     make depend\
  30.  
  31. \f0\fs28\fc0\cf0  \
  32. in a shell, assuming your Makefile was generated by InterfaceBuilder. \
  33. \
  34. In NEXTSTEP Release 3.0, ProjectBuilder provides an "Args" textfield in the Builder inspector.  Just type\
  35. \
  36.  
  37. \f1\fs24\fc1\cf1     depend\
  38.  
  39. \f0\fs28\fc0\cf0 \
  40. in a shell, to generate a Makefile.dependencies file. \
  41. \
  42. In NEXTSTEP Release 3.1, the user interface of ProjectBuilder has been further simplified.  You just select "depend" as your Target for the Build operation. \
  43.  \
  44. Makefile.dependencies contains all the dependencies, listing the files included by your .m files.  A typical line of this file looks something like:\
  45.  
  46. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f1\fc1\cf1 \
  47.  
  48. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fs24\fc1\cf1     MyClass.o : MyClass.m MyClass.h \
  49.  
  50. \f0\fs28\fc0\cf0 \
  51. From then on, when you do a 
  52. \b make 
  53. \b0 in this directory, whether from InterfaceBuilder in NEXTSTEP Release 2,  or from ProjectBuilder in NEXTSTEP Release 3, or a shell, it checks this file before deciding the program is up to date.  Makefile.dependencies can also be edited by hand, if for any reason 
  54. \b make depend 
  55. \b0 doesn't do what you need.  If you add new files to your project, you should delete Makefile.dependencies
  56. \b  
  57. \b0 and regenerate it before recompiling.  Note that ProjectBuilder in NEXTSTEP Release 3 is smart enough to 
  58. \i not
  59. \i0  recompile your files in case only your interfaces file (.nib) has been modified.  It just copied the nib.\
  60. \
  61. In answer to the second question,
  62. \b  cc
  63. \b0  has a -M flag that can be useful if you want to see a listing of 
  64. \b all 
  65. \b0 the header files your source file depends on, including the AppKit and operating system files.  See also the man page.\
  66. \
  67. QA638\
  68.  
  69. \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\f3\fs24\fc1\cf1 \
  70.  
  71. \f0\fs28 Valid for 2.0, 3.0, 3.1
  72. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
  73. \
  74.  
  75.